package cn.cdeden.resource.controller;

import cn.cdeden.common.core.domain.R;
import cn.cdeden.resource.domain.ocr.OcrContent;
import cn.cdeden.resource.service.ISysOcrService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * TODO
 *
 * @author Administrator
 * @date 2024/12/31 9:42
 * @describe:
 **/

@Slf4j
@RestController
@RequestMapping("/ocr")
@RequiredArgsConstructor
public class SysOcrController {


    private final ISysOcrService sysOcrService;
    @GetMapping("/getOcr")
    public R getOcr(){
        return R.ok(sysOcrService.getOcrResult());
    }


    @PostMapping("/upload")
    public R upload(MultipartFile file){
        return R.ok(sysOcrService.upload(file));
    }

    @GetMapping("/status")
    public R getStatus(Long id){
        return R.ok(sysOcrService.getStatus(id));
    }

    @PostMapping("/toLibrary")
    public R toLibrary(@RequestBody OcrContent ocrContent){
        sysOcrService.toLibrary(ocrContent);
        return R.ok();
    }
}
